package com.hfb.mashibing.alip8.juc.c000;

/**
 * new->Ready->Running->Waiting->Blocked->Teminated
 *      ---Runnable---
 */
public class T04_ThreadState {

    static class MyThread extends Thread {
        @Override
        public void run() {
            System.out.println(this.getState());
            for (int i = 0; i < 10; i++) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(i);
            }
            
        }

    }

    public static void main(String[] args) {
        Thread t = new MyThread();
        System.out.println(t.getState());

        t.start();
        try {
            t.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(t.getState());
    }


}
